import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-07-30  14:00
 */
public class Game {
    public static void main(String[] args) {
        Random random = new Random();
        int randnum = random.nextInt(101);
        System.out.println("随机数为：" + randnum);
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要猜的数字>>");
        while(true) {
            int num = scanner.nextInt();
            if(num > randnum) {
                System.out.println("很遗憾，你猜大了！");
            } else if (num == randnum) {
                System.out.println("恭喜你，猜对了！");
                break;
            }else {
                System.out.println("很遗憾，猜小了！");
            }
        }
    }
}
